cmake_minimum_required(VERSION 2.8.11)

set(MODULENAME ${PROJECT_NAME}_core)

file(GLOB YOLO_SOURCE_FILES *.cpp)
file(GLOB CUDA_SOURCE_FILES *.cu)

set(DARKNET_CORE_LIBNAME ${MODULENAME} CACHE INTERNAL "${MODULENAME}: core library" FORCE)
set(DARKNET_CUDA_LIBNAME ${MODULENAME}_cuda CACHE INTERNAL "${MODULENAME}: cuda library" FORCE)
set(YOLO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "${MODULENAME}: Include Directories" FORCE)

CUDA_ADD_LIBRARY(
        ${DARKNET_CUDA_LIBNAME} SHARED
        ${CUDA_SOURCE_FILES})

add_library(${DARKNET_CORE_LIBNAME} SHARED ${YOLO_SOURCE_FILES})
target_link_libraries(
        ${DARKNET_CORE_LIBNAME}
        ${DARKNET_CUDA_LIBNAME}
        ${OpenCV_LIBRARIES}
        ${CUDA_LIBRARIES}
        ${CUDA_CUBLAS_LIBRARIES}
        ${CUDA_curand_LIBRARY}
        ${CMAKE_THREAD_LIBS_INIT})
